#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2024/4/4 14:12
# @Author : 闫峰
# @File    : shopee.py
from common.setting import ensure_path_sep
from utils.mysqlUtils.db_pool import Database
from typing import List, Optional

zhcxkj_center_listing_comprehensive_db = Database(ensure_path_sep("\\config\\shopeev2_config.yaml.bak"),
                                                          "zhcxkj_center_listing_comprehensive")





class ShopeeListingMix:


    @staticmethod
    def get_nosal_listing(source_id, nosales_sku_set):
        get_data_list_sql = """
                SELECT a.id,a.source_id,a.item_id,b.sku
        FROM zhcxkj_center_listing_comprehensive.t_shopee_listing a
        JOIN zhcxkj_center_listing_comprehensive.t_shopee_listing_sku b ON a.item_id=b.item_id
        WHERE 
        a.source_id= %s
        AND a.`status`=1
        AND b.sku in %s
                """
        data_list = zhcxkj_center_listing_comprehensive_db.fetch_all_tuple(get_data_list_sql,
                                                                           (source_id, nosales_sku_set))
        if not len(data_list):
            return False
        return data_list